var express = require('express');
var router = express.Router();

var dbName="blog"

var MongoClient=require("mongodb").MongoClient; 

/* GET users listing. */
router.get('/', function(req, res, next) {
  MongoClient.connect("mongodb://localhost:27017",function(err,client){
    if(err){throw err}
    var db=client.db(dbName);
    const collection=db.collection("myMind");
    collection.find({}).toArray(function(err,data){
      if(err){throw err}
     // console.log(data)
      res.send(data);
      
    })
  })
  
});

module.exports = router;
